<template>
  <div class="search-history">
    <van-cell title="搜索历史">
      <template #right-icon>
        <i class="iconfont icon-shanchu" @click="del(true)"></i>
      </template>
    </van-cell>
    <van-cell
      v-for="(his, index) in searchHistotyList"
      :key="index"
      @click="dosearch(his)"
    >
      <div slot="title">{{ his }}</div>
      <template #right-icon>
        <i class="iconfont icon-guanbi" @click.stop="del(false, index)"></i>
      </template>
    </van-cell>
  </div>
</template>

<script>
export default {
  name: 'SearchHistory',
  data() {
    return {}
  },
  props: {
    searchHistotyList: {
      type: Array,
      required: true
    }
  },
  methods: {
    del(isDelAll, index) {
      this.$emit('del', isDelAll, index)
    },
    dosearch(val) {
      this.$emit('dosearch', val)
    }
  }
}
</script>

<style lang="less" scoped>
</style>
